const _import = require('./_import_' + process.env.NODE_ENV)

import Layout from '../views/layout/Layout'

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    roles: ['admin','editor']     will control the page roles (you can set multiple roles)
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
    noCache: true                if true ,the page will no be cached(default is false)
  }
**/
import welcome from '@/views/welcome.vue';
export const asyncRouterMap = [
  {
    path: '/',
    redirect: '/login',
    hidden: true
  },
  {
    path: '#/',
    redirect: '/login',
    hidden: true
  },
  // 平台首页
  {
    path: '/home',
    component: Layout,
    redirect: '/home/index',
    hidden: true,
    meta: {
      title: '首页',
      icon: 'dashboard',
      noCache: true,
      interfaceName: '首页',
    },
    children: [{
        path: 'index',
        component: _import('home/index'),
        name: 'home',
        meta: {
          title: '首页',
          icon: 'dashboard',
          noCache: true,
          interfaceName: '首页',
        }
      }
    ]
  },
  // 用户新增
  {
    path: '/addUser/',
    component: Layout,
    name: 'addUser',
    redirect: 'addUser',
    meta: {
      title: '用户新增',
      icon: 'example',
      noCache: true,
      interfaceName: '用户新增',
      //  roles:[1]
    },
    children: [{
        path: 'addUserList',
        component: _import('chargingData/addUser'),
        name: 'addUser_List',
        meta: {
          title: '用户新增',
          icon: 'example',
          noCache: true,
          interfaceName: '用户新增'
        }
      }]
  },
  // 
  {
    path: '/chargingData/',
    component: Layout,
    redirect: 'user',
    meta: {
      title: '数据管理',
      icon: 'people',
      noCache: true,
      interfaceName: '数据管理',
    },
    children: [
      {
        path: 'productList',
        component: _import('chargingData/productList'),
        name: 'productList',
        meta: {
          title: '产品列表',
          icon: 'people',
          noCache: true,
          interfaceName: '产品列表',
          roles:[1]
        }
      },
      {
        path: 'charging_data_list',
        component: _import('chargingData/list'),
        name: 'charging_data_list',
        meta: {
          title: '用户查询',
          icon: 'people',
          noCache: true,
          interfaceName: '用户查询',
        }
      },



    ],

  },
   //管理员管理
   {
    path: '/updateData/',
    component: Layout,
    redirect: 'updateData',
    meta: {
      title: '绑定管理',
      icon: 'example',
      noCache: true,
      interfaceName: '绑定管理',
      roles:[]
    },
    children: [
      {
        path: 'updateData_List',
        component: _import('updateData/list'),
        name: 'updateData_List',
        meta: {
          title: '修改信息',
          icon: 'example',
          noCache: true,
          interfaceName: '修改信息',
        }
      }
    ]
  },
 
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

export const constantRouterMap = [{
    path: '/welcome',
    component: Layout,
    redirect: '/welcome/index',
    children: [{
      path: 'index',
      component: welcome,
      name: 'welcome',
      meta: {
        title: '欢迎页',
        icon: 'dashboard',
        noCache: true
      }
    }]
  },
  {
    path: '/',
    redirect: '/login',
    hidden: true
  },
  {
    path: '/login',
    name: 'login',
    component: _import('login/index'),
    hidden: true
  },
  {
    path: '/404',
    name: '404',
    component: _import('errorPage/404'),
    hidden: true
  },
  {
    path: '/401',
    name: '401',
    component: _import('errorPage/401'),
    hidden: true
  },
]

export const constUrl = [
  ...asyncRouterMap,
  ...constantRouterMap
]
